﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/html5.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/respond.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="__PUBLIC__/Admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/Admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/Admin/lib/font-awesome/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
<link href="__PUBLIC__/Admin/lib/font-awesome/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="__PUBLIC__/Admin/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
  <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
  <!--layui-->

  <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
  <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="__PUBLIC__/Admin/js/layer.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<style>
  .navbar-nav > li > a{
    padding:15px 10px;
  }
  .jumbotron{padding:5px 0 0 0;}
</style>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>用户管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="iconfont">&#xf012b;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 散客管理 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<!---->
<div class="modal in" id="uploadExcel" aria-hidden="false" style="display: none; top: 10px">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" onclick="$('#uploadExcel').hide()" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">导入Excel</h4>
      </div>
      <form action="{:U(add_file)}" method="post" enctype="multipart/form-data">
        <div class="modal-body">
        <h4>表格样例</h4>
        <img src="__PUBLIC__/Admin/example.jpg" style="width:100%; border:2px solid red; margin-top:1em ; margin-bottom:1em">
        <h4>请严格按照图示来整理资料，第一列为姓名、第二列为手机号码、第三列为备注内容，其他内容不导入进来， 只支持xls和xlsx格式。</h4>
        <br>
        <div class="form-group">
          <label class="control-label col-lg-2">选择文件：</label>
          <div class="col-lg-10">
            <input type="file" class="btn  radius" name="import">
          </div>
        </div>
      </div>
        <div class="modal-footer">
          <a href="__PUBLIC__/upload/demo.xlsx" download="demo.xlsx" class="btn btn-success">模版展示下载</a>
          <button type="button" class="btn btn-sm btn-default" onclick="$('#uploadExcel').hide()" data-dismiss="modal">关闭</button>
          <button type="submit" class="btn btn-primary radius" >导入</button>
        </div>

      </form>
    </div>
  </div>
</div>
<!---->


  <div class="text-c">
    <input type="text" class="input-text" style="width:250px" placeholder="输入会员名称或者电话" id="" name="search"><button type="button" class="btn btn-success search" id="search" name=""><i class="icon-search"></i> 搜用户</button>
  </div>

  <div class="cl pd-5 bg-1 bk-gray mt-20">
    <span class="l">
      <a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="icon-trash"></i> 批量删除</a>
      <a href="javascript:;" onclick="user_add('550','','添加用户','{:U('add')}')" class="btn btn-primary radius"><i class="icon-plus"></i> 添加散客</a>
          <a href="javascript:;" id="btn" class="btn btn-primary radius"><i class="icon-plus"></i> 导出为表格</a>
          <a href="javascript:;" id="btnss" onclick="$('#uploadExcel').show()" class="btn btn-primary radius"><i class="icon-plus"></i> 导入数据</a>


    </span>




    <span class="r">共有数据：<strong><?php echo count($data); ?></strong> 条</span>


  </div>
  <div class="table2excel">
    <table class="table table-border table-bordered table-hover table-bg table-sort">
      <thead>
      <tr class="text-c">
        <th width="80">ID</th>
        <th width="100">姓名</th>
        <th width="100">手机</th>
        <th width="150">客户来源</th>
        <th width="90">登记日期</th>
        <th width="90">负责人</th>
        <th width="100">编号</th>
        <th width="50">备注</th>
        <th width="50">状态</th>
        <th width="50">操作</th>
      </tr>
      </thead>
      <tbody>
      <?php foreach($data as $k=>$v): ?>
      <tr class="text-c">
        <td><?php echo $v['id']; ?></td>
        <td><u style="cursor:pointer" class="text-primary" onclick="user_show('10001','360','','张三','{:U('user_show')}')"><?php echo $v['username']; ?></u></td>
        <td><?php echo $v['telphone']; ?></td>
        <td><?php echo $v['form']; ?></td>
        <td><?php echo $v['time']; ?></td>
        <td><?php echo $v['charge']; ?></td>
        <td><?php echo $v['code']; ?></td>
        <td><?php echo $v['remarks']; ?></td>
        <php>
          if($v['is_pass'] ==0) {
          $status='未通过'; $logo='stop';
          $cilck = 'start';
          $titile = '通过审核';
          $upDown = 'up';
          }
          else {
          $status='已通过审核'; $logo='success';
          $cilck = 'stop';
          $titile = '停用';
          $upDown = 'down';
          }
        </php>
        <td class="user-status"><span class="label label-{$logo} radius">{$status}</span></td>
        <td class="f-14 user-manage">

          <a href="javascript:;" onclick="user_add('500','','升级成会员','{:U('Member/userToMember','id='.$v['id'])}')" class="btn btn-primary radius icon-plus">升级成会员</a>
          <a style="text-decoration:none" onClick="user_{$cilck}(this,'{$v['id']}')" href="javascript:;" title="{$titile}"><i class="icon-hand-{$upDown}"></i></a>
          <a title="编辑" href="{:U('User/edit','id='.$v['id'])}" class="ml-5" style="text-decoration:none"><i class="icon-edit"></i></a>
          <a title="删除" href="<?php echo U('delete?id=' .$v['id']); ?>" onclick="return confirm('确定要删除么？'); " class="ml-5" style="text-decoration:none"><i class="icon-trash"></i></a></td>
      </tr>
      <?php endforeach; ?>
      <?php echo $page; ?>
      </tbody>
    </table>
  </div>

<script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Admin/jquery.table2excel.js"></script>

<script>

    $(function() {
        $("#btn").click(function(){
            $(".table2excel").table2excel({
                exclude: ".noExl",
                name: "Excel Document Name",
                filename: "散客列表导出",
                exclude_img: true,
                exclude_links: true,
                exclude_inputs: true
            });
        });

    });

</script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/layer1.8/layer.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/laypage/laypage.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/H-ui.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/H-ui.admin.doc.js"></script>
<script type="text/javascript">
$('.table-sort').dataTable({
	"lengthMenu":true,//显示数量选择
	"bFilter": false,//过滤功能
	"bPaginate": true,//翻页信息
	"bInfo": false,//数量信息
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
	]
});

/*用户-停用*/
function user_stop(obj,id){
   if(confirm('确认要停用吗？')){
        $.ajax({
            type: "get",
            url: "downPass/id/" + id,
            dataType: "json",
            success: function (data) {
                if(data == 'true'){
                    $(obj).parents("tr").find(".user-manage").prepend('<a style="text-decoration:none" onClick="user_start(this,id)" href="javascript:;" title="已通过审核"><i class="icon-hand-down"></i></a>');
                    $(obj).parents("tr").find(".user-status").html('<span class="label label-fail radius">已停用</span>');
                    $(obj).remove();
                    layer.msg('已停用');
                }

            }
        });
    }
}
$("#search").on('click',function () {
    var searchData = $(":input[name='search']").val();
    var data;
    if(isNaN(searchData)){
        data ='?username='+searchData
    }else{
        data = '?telphone='+searchData
    }
    window.location.href="{:U('index')}"+data;

});

</script> 

</body>
</html>